import CollectionUtil from '@/framework/infra/collection/CollectionUtil'
import OrderItem from '@/domain/entity/OrderItem'
import OrderStatusEnum from '@/infra/constant/OrderStatusEnum'
import StrUtil from "@/framework/infra/util/strUtil";

export default class Order {
  constructor(props) {
    Object.assign(this, props)
    this.fullAddress = StrUtil.join(' ', this.receiverProvince, this.receiverCity, this.receiverRegion, this.receiverDetailAddress)
    this.orderItemList = CollectionUtil.parse(this.orderItemList, a => new OrderItem(a))
    this.status = OrderStatusEnum.getById(this.status)
  }

  get canSend() {
    return this.status === OrderStatusEnum.WAIT_SEND
  }
}
